package com.howcan.api;

import android.os.Parcel;
import android.os.Parcelable;

public class Category implements Parcelable {

	private int distance;
	private String favicon;
	private int id;
	private String name;
	private int parentId;
	private String searchPara;

	private Category()
	{
	}

	public Category(int i, String s, int j, String s1, int k, String s2)
	{
		id = i;
		name = s;
		parentId = j;
		favicon = s1;
		distance = k;
		searchPara = s2;
	}

	private Category(Parcel parcel)
	{
		id = parcel.readInt();
		name = parcel.readString();
		parentId = parcel.readInt();
		favicon = parcel.readString();
		distance = parcel.readInt();
		searchPara = parcel.readString();
	}

	Category(Parcel parcel, Category category)
	{
		this(parcel);
	}

	Category(Category category)
	{
		this();
	}


	public int describeContents()
	{
		return 0;
	}

	public int distance()
	{
		int i;
		if (distance > 0)
			i = distance;
		else
			i = 500;
		return i;
	}

	public boolean equals(Object obj)
	{
		boolean flag;
		if (obj != this && (!(obj instanceof Category) || ((Category)obj).id != id))
			flag = false;
		else
			flag = true;
		return flag;
	}

	public String favicon()
	{
		return favicon;
	}

	public int hashCode()
	{
		return id;
	}

	public int id()
	{
		return id;
	}

	public String name()
	{
		return name;
	}

	public int parentId()
	{
		return parentId;
	}

	public String searchPara()
	{
		return searchPara;
	}

	public String toString()
	{
		return (new StringBuilder(String.valueOf(id))).append(" : ").append(name).toString();
	}

	public void writeToParcel(Parcel parcel, int i)
	{
		parcel.writeInt(id);
		parcel.writeString(name);
		parcel.writeInt(parentId);
		parcel.writeString(favicon);
		parcel.writeInt(distance);
		parcel.writeString(searchPara);
	}

}

